package love.yuanmengrobot.guoyitang.service.impl;

/*
 *   @Studio:CHJY · 源梦科技
 *   @Author:lzl
 *   @Ide:IntelliJ IDEA
 *   @Creation time:2021/8/11 15:44
 */


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import love.yuanmengrobot.guoyitang.entity.TbNatmehaHotspot;
import love.yuanmengrobot.guoyitang.mapper.TbNatmehaHotspotMapper;
import love.yuanmengrobot.guoyitang.service.HotSpotsService;
import love.yuanmengrobot.guoyitang.vo.Vo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class HotSpotsServiceImpl implements HotSpotsService {
    @Autowired
    private TbNatmehaHotspotMapper hotspotMapper;

    @Override
    public Vo<TbNatmehaHotspot> queryByLimit(Integer current, Integer size) {
        //分页查询
        IPage<TbNatmehaHotspot> hotspotIPage=new Page<>(current,size);
        hotspotIPage=hotspotMapper.selectPage(hotspotIPage,null);
        Vo<TbNatmehaHotspot> voHotspot=new Vo<>();
        voHotspot.setCurrent(current);
        voHotspot.setSize(size);
        voHotspot.setTotal(hotspotIPage.getTotal());
        voHotspot.setList(hotspotIPage.getRecords());

        return voHotspot;
    }
}
